<%--
  Created by IntelliJ IDEA.
  User: zhongwei
  Date: 2014/5/14
  Time: 13:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib prefix="html" uri="http://jakarta.apache.org/struts/tags-html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%
    request.setCharacterEncoding("utf-8");
    response.setCharacterEncoding("utf-8");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8"/>
    <base href="<%=basePath%>"></base>
    <title>网络舆情信息系统-添加站点</title>
    <%@include file="../im.jsp" %>
    <link rel="stylesheet" href="css/pagination.css"/>
    <link rel="stylesheet" href="css/subPage.css"/>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery.pagination.js"></script>

</head>

<body>
<logic:notEmpty name="user">
    <div id="content" class="container">
    <%@include file="../top.jsp" %>

    <div class="row">
    <%@include file="../left.jsp" %>


    <div class="right col-md-10">
    <div id="right_left">
    <html:form action="siteAction.do?method=insert" method="post">
    <html:hidden property="id" value="${bean.id}"></html:hidden>
    <table>
    <tr>
        <td colspan="2">
            <span style="font-weight: bolder;">添加新站点</span>
        </td>
    </tr>
    <tr>

        <td>
            站点名称
        </td>
        <td>
            <html:text onclick="clearERROR();" onblur="validateName();" property="siteName"
                       value="${bean.siteName}"
                       name="siteName"></html:text>
            <span style="color:red" id="site_info"></span>
        </td>
    </tr>
    <tr>
        <td>
            立即应用
        </td>
        <td>
            <html:radio title="立即使用" property="pstatus" value="0"></html:radio>立即使用
            <html:radio title="暂时不用" property="pstatus" value="1"></html:radio>暂不使用
            <script type="application/javascript">
                var i =${bean.pstatus};
                $("input[name=pstatus]").eq(i).attr("checked", "true");
            </script>

        </td>
    </tr>
    <tr>
        <td>
            编码
        </td>
        <td>
            <html:select property="encoding" value="${bean.encoding}">
                <html:option value="utf-8">UTF-8</html:option>
                <html:option value="gbk">GBK</html:option>
                <html:option value="gb2312">gb2312</html:option>
            </html:select>
        </td>
    </tr>
    <tr>
        <td>
            HOST设置
        </td>
        <td>
            <html:text size="20" property="host" value="${bean.host}"></html:text>
            <span style="font-style: oblique;">可选</span>
        </td>
    </tr>
    <tr>
        <td>
            站点类别
        </td>
        <td>
            <html:select property="dtype" value="${bean.dtype}">
                <html:option value="bbs">bbs</html:option>
                <html:option value="news">news</html:option>
                <html:option value="blog">blog</html:option>
                <html:option value="weibo">weibo</html:option>
            </html:select>
        </td>
    </tr>
    <tr>
        <td>
            是否是搜索引擎
        </td>
        <td>
            <html:radio title="不是" property="isse" value="0"></html:radio>不是
            <html:radio title="是" property="isse" value="1"></html:radio>是
            <script type="application/javascript">
                var i =${bean.isse};
                $("input[name=isse]").eq(i).attr("checked", "true");
            </script>

        </td>
    </tr>
    <tr>
        <td>
            页面语种
        </td>
        <td>
            <html:text property="planguage" value="${bean.planguage}"></html:text>
            <span style="font-style: oblique;">cn,en,jp等</span>
        </td>
    </tr>
    <tr>
        <td>
            规则类型
        </td>
        <td>
            <html:select property="ruleType" value="${bean.ruleType}">
                <html:option value="1">xpath</html:option>
                <html:option value="2">css</html:option>
                <html:option value="3">regex</html:option>
                <html:option value="4">jsonpath</html:option>
            </html:select>
        </td>
    </tr>
    <tr>
        <td>
            抽取类型
        </td>
        <td>
            <html:radio title="详情页抽取" property="extractType" value="0"></html:radio>从详情页抽取
            <html:radio title="列表页抽取" property="extractType" value="1"></html:radio>从列表页抽取
            <script type="application/javascript">
                var i =${bean.extractType};
                $("input[name=extractType]").eq(i).attr("checked", "true");
            </script>
            <span style="font-style: italic">正文提取工具适合博客，新闻等</span>
        </td>
    </tr>
    <tr>
        <td>
            初始页URL模版
        </td>
        <td>
            <html:text size="70" property="resultUrlMode" value="${bean.resultUrlMode}"></html:text>

        </td>
    </tr>
    <tr>
        <td></td>
        <td>
            <span style="font-style: oblique;">支持[KEYWORD]关键词，后续将添加更多</span>
        </td>

    </tr>

    <tr>
        <td>
            块规则
        </td>
        <td>
            <html:text size="70" property="blockRule" value="${bean.blockRule}"></html:text>
        </td>
    </tr>
    <tr>
        <td>
            标题规则
        </td>
        <td>
            <html:text size="70" property="titleRule" value="${bean.titleRule}"></html:text>
        </td>
    </tr>
    <tr>
        <td>
            详情页链接规则
        </td>
        <td>
            <html:text size="70" property="linkRule" value="${bean.linkRule}"></html:text>
        </td>
    </tr>
    <tr>
        <td>
            摘要规则
        </td>
        <td>
            <html:text size="70" property="abstextRule" value="${bean.abstextRule}"></html:text>
        </td>
    </tr>
    <tr>
        <td>
            站点规则
        </td>
        <td>
            <html:text size="70" property="siteRule" value="${bean.siteRule}"></html:text>
        </td>
    </tr>
    <tr>
        <td>
            点击量规则
        </td>
        <td>
            <html:text size="70" property="clickNumRule" value="${bean.clickNumRule}"></html:text>
        </td>
    </tr>
    <tr>
        <td>
            回复量规则
        </td>
        <td>
            <html:text size="70" property="replyNumRule" value="${bean.replyNumRule}"></html:text>
        </td>
    </tr>
    <tr>
        <td>
            时间规则
        </td>
        <td>
            <html:text size="70" property="timeRule" value="${bean.timeRule}"></html:text>
        </td>
    </tr>
    <tr>
        <td>
            正文抽取类型
        </td>
        <td>

            <html:radio title="正文抽取" property="contentType" value="0"></html:radio>正文抽取
            <html:radio title="正文提取工具抽取" property="contentType" value="1"></html:radio>正文提取工具
            <html:radio title="不抽取" property="contentType" value="2"></html:radio>不抽取
            <script type="application/javascript">
                var i =${bean.contentType};
                $("input[name=contentType]").eq(i).attr("checked", "true");
            </script>
            <span style="font-style: italic">正文提取工具适合博客，新闻等</span>
        </td>
    </tr>
    <tr>
        <td>
            正文规则
        </td>
        <td>
            <html:text size="70" property="contentRule" value="${bean.contentRule}"></html:text>
        </td>
    </tr>
    <tr>
        <td>
            日期格式
        </td>
        <td>
            <html:text size="20" property="dateformat" value="${bean.dateformat}"></html:text>
        </td>
    </tr>
    <tr>
        <td>
            下一页规则
        </td>
        <td>
            <html:textarea rows="5" cols="58" property="nextPageRules"
                           value="${bean.nextPageRules}"></html:textarea>
        </td>
    </tr>

    <tr>
        <td>

            <html:submit property="submit" value="添加"></html:submit>
            <script type="text/javascript">
                var id = "${bean.id}";
                if (id == "") {
                    id = 0;
                } else {
                    id = parseInt(id);
                }
                if (id > 0) {
                    $("input[name=submit]").val("更新");
                }
            </script>
        </td>
        <td>
            <html:reset property="cancel" value="重置"></html:reset>
        </td>
    </tr>
    </table>
    </html:form>
    <a href="siteAction.do?method=show">返回</a>
    </div>
    <script type="text/javascript">
        function validateName() {
            var siteName = $("input[name=siteName]").val();
            if (siteName == null || siteName == "") {
                $("span#site_info").text("站点名不能为空");
            }
        }
        function clearERROR() {
            $("span#site_info").text("");
        }
    </script>
    </div>
    </div>
    </div>
</logic:notEmpty>
<logic:empty name="user">
    Access Rejected! Error 404
</logic:empty>
</body>
</html>
